package com.zzyl.mapper;

import com.zzyl.entity.NursingProjectPlan;
import com.zzyl.vo.NursingProjectPlanVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NursingProjectPlanMapper {
    /**
     * 根据关联表id查询计划表id
     * @param id
     * @return
     */
    @Select("select plan_id from nursing_project_plan npp where npp.id=#{id}")
    Long selectPlanId(Long id);

    /**
     * 根据护理项目id查询关联表id
     * @param id
     * @return
     */
    @Select("select npp.id from nursing_project_plan npp where npp.project_id=#{id}")
    Long selectRelativeId(Long id);


    /**
     * 根据计划id查询关联表id
     * @param id
     * @return
     */
    @Select("select npp.id from nursing_project_plan npp where npp.plan_id=#{id}")
    Long selectRelativeProjectId(Long id);

    /**
     * 新增计划关联集合数据
     * @param projectPlans
     */
    void addNursingPlanParam(List<NursingProjectPlanVo> projectPlans);



    /**
     * 删除关联表所有数据
     */
    void deleteById(Long planId);


    /**
     * 根据planId查询关联表数据
     * @param id
     * @return
     */
    List<NursingProjectPlan> selectByPlanId(Long id);
}
